module ProjectInfo;
import VersionControl;
import tango.io.Stdout;
import tango.io.FileScan;
import tango.io.FileConduit;
import tango.io.Print;
import tango.io.protocol.Reader;
import tango.text.convert.Layout;
import tango.text.stream.LineIterator;
import tango.io.Console;
import tango.text.convert.Integer;
import Text = tango.text.Util;

final class ProjectInfo{
	
	this(char[] nname, char[] ndirectory){
		name=nname.dup;
		directory=ndirectory.dup;
		loadSettings;
	}
	
	bool getChangeset(int from,inout char[][] tosend,inout char[][] todelete){
		return versionControl.getChangeset(from,tosend,todelete);
	}
	
	private:
	
	void loadSettings(){
		auto fc = new FileConduit (directory~"\\info\\projectinfo.cfg", FileConduit.ReadExisting);
		int i=0;
		foreach (line; new LineIterator!(char) (fc)){
			switch(i){
				case 0:  versionControl=new VersionControl(directory, line); break;
				case 1:  port=toInt(line); break;
				case 2:  threadNumber= toInt(line); break;
			}
			i++;
			if(i==3)break;;
		}
	}
	
	char[] name;
	int port;
	char[] projectAdminPasswd;
	char[] directory;
	VersionControl versionControl;
	int threadNumber;
	
}